Feature/chart library catalog#24
Merged
Merged
Conversation
Foundation for the chart-library work (parse CATALOG files; show per-upload chart info). Two self-contained, tested pieces: - pkg/s57: ParseCatalog/ParseCatalogFS decode an ENC exchange-set CATALOG.031 (ISO 8211 CATD records) into per-file entries — long name (LFIL), IMPL, coverage bbox (SLAT/WLON/NLAT/ELON), CRC — with helpers for base-cell filtering and the union bbox. Decoded positionally from the raw CATD field (NOAA/IHO ASCII layout) since the catalogue carries no DDR subfield labels. Tested against a real NOAA fixture. - internal/engine/baker: ExtractCellMeta gathers per-cell metadata (compilation scale, edition/update/issue date, producing agency, coverage bbox) via the same cheap coverage-only parse the bake's pass 1 uses, so it adds no full re-parse. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Server-side metadata layer for "one pack per upload, named from CATALOG identity" (the chosen model). Pure + unit-tested; wires into the import path next. - catalogPackIdentity: derive a stable pack key from an exchange set — the longest common prefix of cell stems (US5MD1MC/US5MD2NW → "us5md"), a single cell → its full stem, no shared prefix → "" (caller falls back to the upload filename). slug() keeps it a valid set name. - buildSetMeta: assemble a pack's SetMeta from baker.ExtractCellMeta overlaid with the CATALOG.031 catalogue — catalogue LFIL supplies human chart titles and fills coverage bboxes the header lacks; aggregates the scale range, producing agency, union bbox, and cell count. - writeSetMeta/readSetMeta: <pack>.meta.json sidecar beside the archives. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Each uploaded exchange set now becomes its own pack named from its CATALOG identity, with extracted metadata exposed to the library. - extractZipCells: stop dropping CATALOG.031 (its ".031" ext otherwise looked like an ENC update file) — parse it and return the *s57.Catalog. - handleImport: set=auto|"" derives a per-upload pack name via the CATALOG identity (longest common cell prefix → "user-<id>"), uniquified against existing packs; falls back to the cells' prefix then "upload". - bakeAndRegister: after baking, ExtractCellMeta + buildSetMeta (catalogue titles + coverage overlaid) and write the <pack>.meta.json sidecar. - /api/packs merges title/agency/scale-range/cellCount/imported; new GET /api/pack/<name> returns the full per-cell detail. Delete cleans up the sidecar. Verified end to end against a real NOAA upload (US5MD1MC → "user-us5md1mc", "Annapolis Harbor", 1:12000, NOAA): /api/packs + /api/pack both correct. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Complete the chart-library feature on the client: each upload is its own pack with the metadata the backend extracts, and the in-browser OPFS cell store is gone (everything server-side). - chart-service.mjs: importZip()/importZipAndWait() (whole-zip multipart → /api/import?set=auto) and packDetail() (GET /api/pack/<name>). - chart-library.mjs: drop the OPFS store + the in-browser zip cell-selection flow (_archive/_selected/importSelected/renderArchiveList/_refreshCharts). A .zip uploads whole (server names + bakes one pack); a lone .000 uploads + auto-bakes. User packs render from /api/packs with title/scale/agency/counts and a coverage preview; per-cell detail (title/scale/edition/date) loads lazily from /api/pack/<name>. - chart-library.view.mjs: retire archiveList; refresh the import hints. - chartplotter.mjs: remove ChartStore; seed _installed from /api/cells (via _renderInstalledSets); reroute share-restore to bake a "user-shared" server pack instead of caching cells in OPFS. Delete the dead chart-store.mjs. Backend verified end-to-end earlier; the library UI + share-restore want an in-browser check (make serve). go test ./... + web tests + node --check green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CATALOG.031 is often absent or omits titles in real uploads, but the NOAA master index (catalog.json) is a large, separate artifact that must not become a dependency of the server binary or this feature. Title resolution is now purely upload-local: CATALOG.031 LFIL when the exchange set provides it, otherwise no human title — ExtractCellMeta leaves Title empty (S-57 headers carry only the cell code), and consumers fall back to the cell Name. All other metadata (scale/edition/date/agency/ coverage) still comes from each cell's own header, so a catalogue-less upload is fully described regardless. Adds a no-CATALOG test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # web/src/plugins/chart-library.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.